package com.hsh.server.project.bank.service.impl;

import java.util.List;

import com.hsh.server.interceptor.UserUtils;
import com.hsh.server.project.bank.domain.TAppAccount;
import com.hsh.server.project.bank.mapper.TAppAccountMapper;
import com.hsh.server.project.bank.service.ITAppAccountService;
import com.hsh.server.util.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 账户Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-04-23
 */
@Service
public class TAppAccountServiceImpl implements ITAppAccountService
{
    @Autowired
    private TAppAccountMapper tAppAccountMapper;

    /**
     * 查询账户
     * 
     * @param id 账户主键
     * @return 账户
     */
    @Override
    public TAppAccount selectTAppAccountById(Long id)
    {
        return tAppAccountMapper.selectTAppAccountById(id);
    }

    /**
     * 查询账户列表
     * 
     * @param tAppAccount 账户
     * @return 账户
     */
    @Override
    public List<TAppAccount> selectTAppAccountList(TAppAccount tAppAccount)
    {
        tAppAccount.setUserId(UserUtils.getUserInfo().getId());
        return tAppAccountMapper.selectTAppAccountList(tAppAccount);
    }

    /**
     * 新增账户
     * 
     * @param tAppAccount 账户
     * @return 结果
     */
    @Override
    public int insertTAppAccount(TAppAccount tAppAccount)
    {
        tAppAccount.setCreateTime(DateUtils.getNowDate());
        return tAppAccountMapper.insertTAppAccount(tAppAccount);
    }

    /**
     * 修改账户
     * 
     * @param tAppAccount 账户
     * @return 结果
     */
    @Override
    public int updateTAppAccount(TAppAccount tAppAccount)
    {
        return tAppAccountMapper.updateTAppAccount(tAppAccount);
    }

    /**
     * 批量删除账户
     * 
     * @param ids 需要删除的账户主键
     * @return 结果
     */
    @Override
    public int deleteTAppAccountByIds(Long[] ids)
    {
        return tAppAccountMapper.deleteTAppAccountByIds(ids);
    }

    /**
     * 删除账户信息
     * 
     * @param id 账户主键
     * @return 结果
     */
    @Override
    public int deleteTAppAccountById(Long id)
    {
        return tAppAccountMapper.deleteTAppAccountById(id);
    }
}
